<!DOCTYPE html>
<html lang="en">

<include file="CommonSidebar:common-head"/>
<link rel="stylesheet" href="__ROOT__/Application/Admin/Public/css/common.css">

<body>

<div id="wrapper">

    <!-- Navigation -->
    <include file="CommonSidebar:common-navbar"/>

    <div id="page-wrapper">
        <div class="row">
            <div class="col-lg-12">
                <h1 class="page-header">首页信息</h1>
            </div>

            <div class="row">
                <div class="col-md-12">
                    <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
                        <div class="panel panel-default">
                            <div class="panel-heading" role="tab" id="headingOne">
                                <h4 class="panel-title">
                                    <a role="button" data-toggle="collapse" data-parent="#accordion"
                                       href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                        搜索栏
                                    </a>
                                </h4>
                            </div>
                            <div id="collapseOne" class="panel-collapse collapse " role="tabpanel"
                                 aria-labelledby="headingOne">
                                <div class="panel-body">
                                    <form action="{:U('index')}" class="form-horizontal" method="post">
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">页面位置</label>

                                            <div class="col-sm-4">
                                                    <select class="form-control" name="PAGE" required>
                                                        <option value="">请选择...</option>
                                                        <option value="1">主页</option>
                                                        <option value="2">二级子页面1</option>
                                                        <option value="3">二级子页面2</option>
                                                        <option value="4">二级子页面3</option>
                                                        <option value="5">二级子页面4</option>
                                                    </select>
                                            </div>
                                            <label class="col-sm-2 control-label">图片类型</label>

                                            <div class="col-sm-4">
                                                <select class="form-control" name="TYPE" required>
                                                    <option value="">请选择...</option>
                                                    <option value="1">轮播图</option>
                                                    <option value="2">广告图</option>
                                                    <option value="3">专题图</option>
                                                </select>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <div class="col-sm-10 col-sm-offset-2">
                                                <button type="submit" class="btn  btn-primary">筛选</button>
                                            </div>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <!-- /.row -->
        <div class="row">
            <div class="col-lg-12">
                <a href="{:U('add')}" class='btn btn-default'>新建图片</a>

                <h1></h1>
            </div>
        </div>

        <div class="row">
            <div class="col-lg-12">
                <div class="panel panel-default">
                    <!-- /.panel-heading -->
                    <div class="panel-body">
                        <div class="dataTable_wrapper">
                            <table class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <th style="text-align:center" width="30%">图片</th>
                                    <th style="text-align:center">图片位置</th>
                                    <th style="text-align:center">图片类型</th>
                                    <th style="text-align:center">关联商品名称/跳转链接</th>
                                    <th style="text-align:center">图片排序位置</th>
                                    <th width="10%" style="text-align:center">操作</th>
                                </tr>
                                </thead>
                                <tbody>
                                <foreach name="data" item="v" key="k">
                                    <tr class="odd gradeX">
                                        <td><img width="100px" src="__ROOT__/{$v.PIC_PATH}"/></td>

                                        <td><?php
                                                    if($v['PAGE']==1){
                                                        echo "主页";
                                                    }
                                                     if($v['PAGE']==2){
                                                        echo "二级子页面1";
                                                    }
                                                    if($v['PAGE']==3){
                                                        echo "二级子页面2";
                                                    }
                                                     if($v['PAGE']==4){
                                                        echo "二级子页面3";
                                                    }
                                                     if($v['PAGE']==5){
                                                        echo "二级子页面4";
                                                    }

                                                ?></td>

                                        <td><?php
                                                    if($v['TYPE']==1){
                                                        echo "轮播图";
                                                    }
                                                     if($v['TYPE']==2){
                                                        echo "广告图";
                                                    }
                                                    if($v['TYPE']==3){
                                                        echo "专题图";
                                                    }
                                                ?></td>
                                        <td>{$v.URL}</td>
                                        <td>{$v.SORT}</td>
                                        <td class="center"><a href="javascript:void(0)" onclick="DeleteTar('{$v.ID}')" title="Delete">删除</a>
                                        --<a href="{:U('Pic/updateindex')}?ID={$v.ID}"   target="_blank">编辑</a>
                                        </td>

                                    </tr>
                                </foreach>
                                </tbody>
                            </table>
                        </div>
                        <!-- /.table-responsive -->
                    </div>
                    <!-- /.panel-body -->
                </div>
                <!-- /.panel -->
            </div>
            <!-- /.col-lg-12 -->
        </div>
        <!-- /.row -->
    </div>
    <!-- /#page-wrapper -->

</div>
<!-- /#wrapper -->

<include file="CommonSidebar:common-script"/>

<!-- DataTables JavaScript -->
<script src="__ROOT__/Application/Admin/Public/bower_components/datatables/media/js/jquery.dataTables.min.js"></script>
<script src="__ROOT__/Application/Admin/Public/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min.js"></script>

<!-- Custom Theme JavaScript -->
<script src="__ROOT__/Application/Admin/Public/dist/js/sb-admin-2.js"></script>

<!-- Page-Level Demo Scripts - Tables - Use for reference -->
<script>
    $(document).ready(function () {
        $('#dataTables-example').DataTable({
            responsive: true
        });
    });
</script>
<script type="text/javascript">
    function DeleteTar(id) {
        if (confirm('确定删除?')) {
            $.ajax({
                type: "POST",
                url: "{:U('del')}",
                data: {
                    id: id,
                },
                dataType: "json",
                success: function (result) {
                    window.location.href = "{:U('index')}";
                },
                error: function () {
                    alert('网络连接失败！');
                }
            });
        }
    }
</script>
</body>

</html>
